package com.infoholdcity.common.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.infoholdcity.common.common.QueryConditionsResVo;
import com.infoholdcity.common.entity.QueryConditionsMain;
import com.infoholdcity.common.mapper.QueryConditionsMainMapper;
import com.infoholdcity.common.service.QueryConditionsMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 查询条件主表 服务实现类
 * </p>
 *
 * @author jinshihui
 * @since 2025-02-20
 */
@Service
@DS("slave_1")
public class QueryConditionsMainServiceImpl extends ServiceImpl<QueryConditionsMainMapper, QueryConditionsMain> implements QueryConditionsMainService {

    @Autowired
    private QueryConditionsMainMapper queryConditionsMainMapper;

    @Override
    public List<QueryConditionsResVo> getQueryConditionsResVoByUserName(String username) {
        List<QueryConditionsResVo> queryConditionsResVoByUserName = queryConditionsMainMapper.getQueryConditionsResVoByUserName(username);
        if (queryConditionsResVoByUserName != null) {
            return queryConditionsResVoByUserName;
        }
        return Collections.emptyList();
    }
}
